package com.haochang.chunkvod.controller.activity.cash;

import java.util.ArrayList;
import java.util.List;

import com.haochang.base.BaseActivity;
import com.haochang.base.BaseListView;
import com.haochang.chunkvod.R;
import com.haochang.chunkvod.controller.adapter.cash.PendOperateDetailsAdapter;
import com.haochang.chunkvod.model.cash.TakeOutInfo;
import com.haochang.chunkvod.view.vod.popupWindow.VodPopWindow;
import com.haochang.chunkvod.view.vod.title.TitleView;

import android.os.Bundle;
import android.widget.ImageView;

/**
 *@author qintao
 *created at 2016/11/9 16:43
 * 挂单详情-可编辑的
 */

public class PendOperateDetailsActivity extends BaseActivity
{
	private TitleView titleView;
	private BaseListView listView;
	private PendOperateDetailsAdapter pendOperateDetailsAdapter;
	private List<TakeOutInfo> takeOutInfoList = new ArrayList<TakeOutInfo>();

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
	}

	@Override
	public void receiveParam()
	{

	}

	@Override
	public void initData()
	{
		TakeOutInfo takeOutInfo = new TakeOutInfo();
		takeOutInfo.setSerialNumber("45457878");
		takeOutInfo.setOrderTime("17:25");
		takeOutInfo.setTotalPrice(150);
		takeOutInfo.setRoomNum("Vo1");
		takeOutInfo.setSource("潮湿");

		takeOutInfoList.add(takeOutInfo);
		takeOutInfoList.add(takeOutInfo);
		takeOutInfoList.add(takeOutInfo);
	}

	@Override
	public void initViews()
	{
		setContentView(R.layout.activity_pend_operate_details);
		titleView = (TitleView) findViewById(R.id.titleView);
		titleView.setTitle(R.string.pend_details).setTitleOnClickListener(new TitleView.ITitleOnClickListener()
		{
			@Override
			public void onBackClick()
			{
				finish();
			}

			@Override
			public void onDoneClick()
			{
				List<String> list = new ArrayList<String>();
				list.add("退出登录");
				int location[] = new int[2];
				ImageView img = (ImageView) titleView.findViewById(R.id.img_operates);
				img.getLocationOnScreen(location);
				int x = location[0];
				final VodPopWindow pop = new VodPopWindow(PendOperateDetailsActivity.this, list);
				pop.showPopupWindow(titleView, x);
				pop.setPopWindowListListener(new VodPopWindow.OnPopWindowListListener()
				{
					@Override
					public void onSelectItem(int position)
					{
						switch (position)
						{
						case 0:
							loginOut();
							break;
						default:
							break;
						}
					}
				});
			}
		});
		listView = (BaseListView) findViewById(R.id.listView);
		pendOperateDetailsAdapter = new PendOperateDetailsAdapter(PendOperateDetailsActivity.this, R.layout.item_pend_operate_list_layout, takeOutInfoList);
		listView.setAdapter(pendOperateDetailsAdapter);
	}
}
